<template>
  <div class="upload">
    <el-upload
      ref="elUpload"
      drag
      action
      multiple
      :auto-upload="false"
      :show-file-list="true"
      :http-request="uploadFile"
      :on-error="error"
      :on-change="change"
      :on-success="success"
    >
      <i class="el-icon-upload" />
      <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
      <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div>
    </el-upload>

    <el-button @click="handleUpload">Upload</el-button>
    <el-button @click="handleDownload">download</el-button>
  </div>
</template>

<script>
import TxCosUpload from '@/libs/mixin/TXCosUpload'
import TxCosDownload from '@/libs/mixin/TXCosDownload'
export default {
  name: 'txOss',
  mixins: [TxCosUpload, TxCosDownload],
  data() {
    return {
    }
  },
  methods: {
    handleDownload() {
      this.donwloadFile('9401818037951.txt', '2.txt')
    },
    handleUpload() {
      this.$refs.elUpload.submit()
    }
  }
}
</script>

<style lang='scss' scoped>
.upload{
  width: 400px;
  height: 100%;
}
</style>
